package com.mgm.exception;

import com.mgm.result.IMessage;

/**
 * 
 * @ClassName: CustomException 
 * @Description: 自定义异常类 
 * @author Andy Zhang
 * @date 2018年6月22日 下午11:51:26 
 *
 */
public class CustomException extends RuntimeException{

	/**
	 * serialVersionUID.
	 */
	private static final long serialVersionUID = 1L;
	
	private Integer code; //根据业务确定 0=error
	
	private Integer status = 500; //默认500--服务器错误
	
	public CustomException(String message) {
		super(message);
		this.code = 0;
	}

	public CustomException(IMessage imessage) {
		super(imessage.getMsg());
		this.code = imessage.getCode();
		this.status = imessage.getStatus();
	}

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

}
